﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Sofire.DataComm.Remoting
{
    internal class RemotingLoginResultValue
    {
        private byte[] _methodsBytes;
#if !SILVERLIGHT
        [NonSerialized]
#else
        [Ignore]
#endif
        private List<MethodSyncInfo> _Methods;
        public List<MethodSyncInfo> Methods
        {
            get
            {

                if(this._Methods == null && this._methodsBytes != null)
                {
                    lock(this)
                    {
                        if(this._Methods == null && this._methodsBytes != null)
                        {
                            this._Methods = RemotingShare.Formatter.FastReadBytes<List<MethodSyncInfo>>(this._methodsBytes);
                        }
                    }
                }
                return this._Methods;
            }
        }

        private int _ServiceVersion;
        public int ServiceVersion
        {
            get
            {
                return this._ServiceVersion;
            }
        }

        private string _SessionID;
        public string SessionID
        {
            get
            {
                return this._SessionID;
            }
            set
            {
                this._SessionID = value;
            }
        }

        private RemotingLoginResultValue() { }

        internal RemotingLoginResultValue(int serviceVersion, string sessionID, byte[] methodsBytes)
        {
            this._ServiceVersion = serviceVersion;
            this._SessionID = sessionID;
            this._methodsBytes = methodsBytes;
        }

    }
}
